import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router';
import Home from '../views/Home.vue';

const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    redirect:'/index'
  },
  {
    path: '/index',
    name: 'index',
    component: () => import('../views/index.vue'),
  },
  {
    path: '/lifecycle',
    name: 'lifecycle',
    component: () => import('../views/lifecycle.vue'),
  },
  {
    path: '/computed',
    name: 'computed',
    component: () => import('../views/computed.vue'),
  },
  {
    path: '/dom',
    name: 'dom',
    component: () => import('../views/dom.vue'),
  },
  {
    path: '/watch',
    name: 'watch',
    component: () => import('../views/watch.vue'),
  },
  {
    path: '/hook',
    name: 'hook',
    component: () => import('../views/hook.vue'),
  },
  {
    path: '/mixin',
    name: 'mixin',
    component: () => import('../views/mixin.vue'),
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('../views/test.vue'),
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue'),
  },
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes,
});

export default router;
